<?php

class Form_ContractorForm extends Form_Custom_General {

    public function init() {

        $cont_id = $this->createElement('hidden', 'cont_id')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($cont_id);


        $cont_title = $this->createElement('select', 'cont_title')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array( "class" => ""));
                #->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("customer_required_company"))));
        $this->addElement($cont_title);
        

        $cont_firstname = $this->createElement('text', 'cont_firstname')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' =>$this->translateObj->translate("contractor_required_firstname"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_firstname")));
        $this->addElement($cont_firstname);

        $cont_lastname = $this->createElement('text', 'cont_lastname')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_lastname"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_lastname")));
        $this->addElement($cont_lastname);


        $cont_phone = $this->createElement('text', 'cont_phone')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_phone"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_phone")));
        $this->addElement($cont_phone);
        
        $cont_mobile_no = $this->createElement('text', 'cont_mobile_no')
                #->setRequired(TRUE)
                #->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_phone"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_mobile")));
        $this->addElement($cont_mobile_no);


        $lgn_email = $this->createElement('text', 'lgn_email')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_email"))))
                ->addValidator(new Zend_Validate_EmailAddress())
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_email")));
        $lgn_email->getValidator('emailAddress')->setMessage($this->translateObj->translate("contractor_required_valid_email"), Zend_Validate_EmailAddress::INVALID_FORMAT);
        $this->addElement($lgn_email);


      

        $lgn_password = $this->createElement('password', 'lgn_password')
                # ->setRequired(TRUE)
                # ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Password should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "20", "class" => "span6"));
        $this->addElement($lgn_password);


        $lgn_confirmpassword = $this->createElement('password', 'lgn_confirmpassword')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_password"))))
                ->setAttribs(Array("size" => "20", "class" => "span6"));
        $this->addElement($lgn_confirmpassword);
        
        $com_id = $this->createElement('select', 'com_id')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array( "class" => "select2"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_company"))));
        $this->addElement($com_id);
        
        
         $dep_id = $this->createElement('multiselect', 'dep_id')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_department"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("class" => "select2", "placeholder" => $this->translateObj->translate("contractor_frm_department")));
        $this->addElement($dep_id);
        
        
        $cont_address = $this->createElement('textarea', 'cont_address')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_address"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim()
                ))
                ->setAttribs(Array("size" => "60", "cols" => "50", "rows" => "3", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_address")));
        $this->addElement($cont_address);

        $cont_city = $this->createElement('text', 'cont_city')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_city"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim()
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_city")));
        $this->addElement($cont_city);



        $cont_state = $this->createElement('text', 'cont_state')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_state"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_state")));
        $this->addElement($cont_state);

        $cont_country = $this->createElement('select', 'cont_country')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array( "class" => "select2"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_country"))));
        $this->addElement($cont_country);

        $cont_zipcode = $this->createElement('text', 'cont_zipcode')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_zipcode")));
        $this->addElement($cont_zipcode);

        $cont_quality = $this->createElement('select', 'cont_quality')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_quality"))));
        $this->addElement($cont_quality);

        $cont_securityquestion = $this->createElement('text', 'cont_securityquestion')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_security_ques"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_security_ques")));
        $this->addElement($cont_securityquestion);

        $cont_securityanswer = $this->createElement('text', 'cont_securityanswer')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_security_ans"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("contractor_frm_security_ans")));
        $this->addElement($cont_securityanswer);

        $cont_availability = $this->createElement('select', 'cont_availability')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_availabilty"))));
        $this->addElement($cont_availability);
        
        
        $lang_id = $this->createElement('select', 'lang_id')
                #->setRequired(TRUE)
                ->setAttribs(Array( "class" => "select2"))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ));
        $this->addElement($lang_id);
        
        $cont_status = $this->createElement('select', 'cont_status')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("contractor_required_status"))));
        $this->addElement($cont_status);

        $submit = $this->createElement('submit', 'Save')
                ->setAttribs(Array('title' => "Save changes", 'class' => "btn-glow primary"))
                ->setLabel($this->translateObj->translate("frm_save"));
        $this->addElement($submit);


        $reset = $this->createElement('reset', 'Reset')
                ->setAttribs(Array('title' => "Save changes and continue to edit", 'class' => "btn-glow primary"))
                ->setLabel($this->translateObj->translate("frm_reset"));
        $this->addElement($reset);
    }

}